<?php 
 
 session_start();
 include_once('taskmodel.php'); 

 ?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
      
    <link rel="shortcut icon" href="assets/ico/favicon.ico">

    <title>GROCERY EXPRESS</title>

    <!-- Bootstrap core CSS -->
    <link href="assets/css/bootstrap.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="assets/css/custom.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
    <link href="assets/css/font-awesome.min.css" rel="stylesheet">
	

    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
	<script src="assets/js/modernizr.custom.js"></script>
     <script src="assets/js/cbpFWTabs.js"></script>
    <script src="assets/js/modernizr.js"></script>
	<script src="js/classie.js"></script>
		<script src="js/cbpViewModeSwitch.js"></script>
  </head>

  <body>

     <!-- Fixed navbar -->

           <?php 
            //if 
            $loggedin=$_SESSION['loggedin'];
            if($loggedin)
            {
                include('navbarloggedinitems.php');
            }
            else
            {
            include('navigationitems.php');
            }
            ?>

	<!-- *****************************************************************************************************************
	 BLUE WRAP
	 ***************************************************************************************************************** -->
    <div class="container">
 	            <?php
                  // to prevent undefined index notice
                    $action = isset($_GET['action']) ? $_GET['action'] : "";
                    $id = isset($_GET['id']) ? $_GET['id'] : "1";
                    $name = isset($_GET['name']) ? $_GET['name'] : "";
                    $quantity = isset($_GET['quantity']) ? $_GET['quantity'] : "";
        
                    if($action=='added'){
                        echo "<div style='margin-top:70px 'class='alert alert-info'>";
                            echo "<strong>{$name}</strong> was added to your cart!";
                        echo "</div>";
                    }
 
                    else if($action=='exists'){
                        echo "<div style='margin-top:70px ' class='alert alert-info'>";
                            echo "<strong>{$name}</strong> already exists in your cart!";
                        echo "</div>";
                    }
                 ?>
	 <!-- *****************************************************************************************************************
	 TABS
	 ***************************************************************************************************************** -->
	<div id="tabs" class="tabs">
    <nav>
        <ul>
            <li><a href="#section-1" class="icon-shop"><span>Beverages</span></a></li>
            <li><a href="#section-2" class="icon-cup"><span>Canned Goods</span></a></li>
            <li><a href="#section-3" class="icon-food"><span>Dairy</span></a></li>
            <li><a href="#section-4" class="icon-lab"><span>Instant Goods</span></a></li>
            <li><a href="#section-5" class="icon-truck"><span>Snacks</span></a></li>
        </ul>
    </nav>
	
			<!--johnsardine.com/freebies/dl-html-css/simple-little-tab    http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_type_number/-->
    <div class="content">
        <section id="section-1">
        <?php 

                $results = getBeverages();
                     foreach($results as $row) {
                            $id = $row['productNumber'];
                            $productname = $row['productName'];
                            $price = number_format($row['price'],2,'.','');
                            $image = $row['images'];
                             //echo $id." ".$name." ".$price." ".$image;
                            echo "<div align = 'center' class='mediabox'>";
                            echo "<img src='assets/img/beverages/$image'  alt='img'.'$name'/>";
                            echo "<h4>$productname</h4>";
                            echo "<p>$price"."  Php</p>";
                            echo "<form action = 'add_to_cart.php?id={$id}&name={$name}&quantity={$quantity}' method='get'>";
                            echo "<input type='hidden' name ='id' value=$id>";
                            echo "<input type='hidden' name ='name' value='$productname'>";
                            echo "<input type='number' name='quantity' min='1' max='100' maxlength='1'>";
                           //<form action = "insertRegisteredUser.php" id = "form" method = "post">
                            //echo "<a href='add_to_cart.php?id={$id}&name={$productname}&quantity={$quantity}' class='cbp-vm-icon cbp-vm-add'>Add</a>";
                            echo "<input type='submit' value ='Add'></input>";
                            echo "</form>";
                            echo "</div>";
                    }
          ?>
            <!--
                             <input type="number" name="quantity" min="1" max="100" maxlength="1">
                             <a href="add_to_cart.php?id=$id&name=$name" class="cbp-vm-icon cbp-vm-add">Add</a>
           -->
       
        </section>
        <section id="section-2">
        <?php 
                $results = getCannedGoods();
                     foreach($results as $row) {
                            $id = $row['productNumber'];
                            $name = $row['productName'];
                            $price = number_format($row['price'],2,'.','');
                            $image = $row['images'];
                            //echo $id." ".$name." ".$price." ".$image;
                            echo "<div align = 'center' class='mediabox'>";
                            echo "<img src='assets/img/canned goods/$image'  alt='img'.'$name'/>";
                            echo "<h4>$name</h4>";
                            echo "<p>$price"."  Php</p>";
                                //echo "<div class='input-group'>";
                                echo "<input type='number' name='quantity' min='1' max='100' maxlength='1'>";

                                echo "<a href='add_to_cart.php?id=$id&name=$name' class='cbp-vm-icon cbp-vm-add'>Add</a>";
                                //echo "</div>";
                            echo "</div>";
                    }
        ?>
        </section>
        <section id="section-3">
        <?php 
                $results = getDairy();
                     foreach($results as $row) {
                            $id = $row['productNumber'];
                            $name = $row['productName'];
                            $price = number_format($row['price'],2,'.','');
                            $image = $row['images'];
                            //echo $id." ".$name." ".$price." ".$image;
                            echo "<div align = 'center' class='mediabox'>";
                            echo "<img src='assets/img/dairy/$image'  alt='img'.'$name'/>";
                            echo "<h4>$name</h4>";
                            echo "<p>$price"."  Php</p>";
                                //echo "<div class='input-group'>";
                                echo "<input type='number' name='quantity' min='1' max='100' maxlength='1'>";
                                echo "<a href='add_to_cart.php?id=$id&name=$name' class='cbp-vm-icon cbp-vm-add'>Add</a>";
                                //echo "</div>";
                            echo "</div>";
                    }
        ?>
        </section>
        <section id="section-4">
        <?php 
                $results = getInstantGoods();
                     foreach($results as $row) {
                            $id = $row['productNumber'];
                            $name = $row['productName'];
                            $price = number_format($row['price'],2,'.','');
                            $image = $row['images'];
                            //echo $id." ".$name." ".$price." ".$image;
                            echo "<div align = 'center' class='mediabox'>";
                            echo "<img src='assets/img/instant goods/$image'  alt='img'.'$name'/>";
                            echo "<h4>$name</h4>";
                            echo "<p>$price"."  Php</p>";
                                //echo "<div class='input-group'>";
                                echo "<input type='number' name='quantity' min='1' max='100' maxlength='1'>";
                                echo "<a href='add_to_cart.php?id=$id&name=$name' class='cbp-vm-icon cbp-vm-add'>Add</a>";
                                //echo "</div>";
                            echo "</div>";
                    }
        ?>
        </section>
        <section id="section-5">
        <?php 
                $results = getSnacks();
                     foreach($results as $row) {
                            $id = $row['productNumber'];
                            $name = $row['productName'];
                            $price = number_format($row['price'],2,'.','');
                            $image = $row['images'];
                            //echo $id." ".$name." ".$price." ".$image;
                            echo "<div align = 'center' class='mediabox'>";
                            echo "<img src='assets/img/snacks/$image'  alt='img'.'$name'/>";
                            echo "<h4>$name</h4>";
                            echo "<p>$price"."  Php</p>";
                                //echo "<div class='input-group'>";
                                echo "<input type='number' name='quantity' min='1' max='100' maxlength='1'>";
                                echo "<a href='add_to_cart.php?id=$id&name=$name' class='cbp-vm-icon cbp-vm-add'>Add</a>";
                                //echo "</div>";
                            echo "</div>";
                    }
        ?>
        </section>
    </div><!-- /content -->
</div><!-- /tabs -->
        
    </div><!--container-->
<script src="js/cbpFWTabs.js"></script>
<script>
    new CBPFWTabs( document.getElementById( 'tabs' ) );
</script>


	<!-- *****************************************************************************************************************
	 FOOTER
	 ***************************************************************************************************************** -->
	<?php include('footer.php');?>
	 
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
    <script src="assets/js/bootstrap.min.js"></script>
	<script src="assets/js/retina-1.1.0.js"></script>
	<script src="assets/js/jquery.hoverdir.js"></script>
	<script src="assets/js/jquery.hoverex.min.js"></script>
	<script src="assets/js/jquery.prettyPhoto.js"></script>
  	<script src="assets/js/jquery.isotope.min.js"></script>
  	<script src="assets/js/custom.js"></script>

      <script>

      $("tr1").mouseover(function(){
    $("#displayDiv img").attr("assets/img/beverages/2.jpg",$(this).attr("src"));
});
      </script>

      

  </body>
</html>
